package com.base.admin.vo;

import lombok.Data;

/**
 * 统一返回类
 * @author rqq
 */
@Data
public class ResultBean<T> {
    private Integer code;
    private String msg;
    private T data;

    public ResultBean(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
        this.data = null;
    }

    public ResultBean(Integer code, String msg, T data) {
        this(code, msg);
        this.data = data;
    }

    public static ResultBean<Void> success() {
        return new ResultBean<>(20000, "");
    }
    public static<T> ResultBean<T> success(T data) {
        return new ResultBean<T>(20000, "", data);
    }

    public static ResultBean<Void> error(String msg) {
        return new ResultBean<>(50000, msg);
    }
}
